package cn.exrick.xboot.modules.gatestation.controller;

import cn.exrick.xboot.base.XbootBaseController;
import cn.exrick.xboot.common.utils.PageUtil;
import cn.exrick.xboot.common.utils.ResultUtil;
import cn.exrick.xboot.common.vo.PageVo;
import cn.exrick.xboot.common.vo.Result;
import cn.exrick.xboot.common.vo.SearchVo;
import cn.exrick.xboot.modules.gatestation.entity.NaturalgasAlarmin;
import cn.exrick.xboot.modules.gatestation.service.NaturalgasAlarminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;



/**
 * @author yck
 */
@Slf4j
@RestController
@Api(description = "天燃气报警信息管理接口")
@RequestMapping("/xboot/naturalgasAlarmin")
@Transactional
public class NaturalgasAlarminController extends XbootBaseController<NaturalgasAlarmin, String> {

    @Autowired
    private NaturalgasAlarminService naturalgasAlarminService;

    @Override
    public NaturalgasAlarminService getService() {
        return naturalgasAlarminService;
    }

    @RequestMapping(value = "/getByCondition", method = RequestMethod.GET)
    @ApiOperation(value = "多条件分页获取")
    public Result<Page<NaturalgasAlarmin>> getByCondition(NaturalgasAlarmin naturalgasAlarmin,
                                                            SearchVo searchVo,
                                                            PageVo pageVo){

        Page<NaturalgasAlarmin> page = naturalgasAlarminService.findByCondition(naturalgasAlarmin, searchVo, PageUtil.initPage(pageVo));
        return new ResultUtil<Page<NaturalgasAlarmin>>().setData(page);
    }
}
